<?php

/**
 * Menashop
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this project in the file LICENSE.txt
 *
 * @category   Zend
 * @package    Storefront_Model
 * @subpackage FormOrder
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 * @version    1.0.0
 * @since      File available since Release 1.0.0
 */

/**
 * The form for order
 * 
 * @category   Zend
 * @package    Storefront_Model
 * @subpackage FromOrder
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 */
class Storefront_Model_FormOrder extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');

        $fullName = new Zend_Form_Element_Text('full_name');
        $fullName->setRequired(true);
        $fullName->addValidator('StringLength', false, array(2, 50));
        $fullName->addErrorMessage('Please provide your full name');
        $fullName->removeDecorator('label');
        $fullName->removeDecorator('htmlTag');
        $fullName->removeDecorator('Errors');

        $email = new Zend_Form_Element_Text('email');
        $email->addValidator('EmailAddress');
        $email->addErrorMessage('Please provide a correct e-mail');
        $email->removeDecorator('label');
        $email->removeDecorator('htmlTag');
        $email->removeDecorator('Errors');

        $phone = new Zend_Form_Element_Text('phone');
        $phone->setRequired(true);
        $phone->addErrorMessage('Please provide your phone');
        $phone->addValidator('StringLength', false, array(5, 50));
        $phone->removeDecorator('label');
        $phone->removeDecorator('htmlTag');
        $phone->removeDecorator('Errors');

        $city = new Zend_Form_Element_Text('city');
        $city->addValidator('StringLength', false, array(2, 50));
        $city->removeDecorator('label');
        $city->removeDecorator('htmlTag');
        $city->removeDecorator('Errors');

        $address = new Zend_Form_Element_Text('address');
        $address->addValidator('StringLength', false, array(2, 30));
        $address->removeDecorator('label');
        $address->removeDecorator('htmlTag');
        $address->removeDecorator('Errors');

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Order');
        $submit->removeDecorator('DtDdWrapper');

        $this->setDecorators(array(array('ViewScript', array('viewScript' => '_form_order.phtml'))));
        $this->addElements(array($fullName, $email, $phone, $city, $address, $submit));
    }

}

